package com.kfm.company.controller;

import com.kfm.company.model.Dept;
import com.kfm.company.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/dept")
public class DeptController {


    @Autowired
    DeptService service;

    @RequestMapping("/list")
    public ModelAndView list() {
        ModelAndView mv = new ModelAndView("/dept/list");
        List<Dept> all = service.findAll();
        mv.addObject("all", all);
        return mv;
    }
}
